<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>documentName</title>
    <link rel="stylesheet" href="" />
  </head>
  <body>
    <h4>debug</h4>
    <form id="myform">
      <div>
        <span>姓名：</span>
        <input type="text" name="uname" />
      </div>
      <div>
        <span>邮箱：</span>
        <input type="text" name="email" />
      </div>
      <button submit>提交</button>
    </form>

    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.20.0/jquery.validate.min.js"></script>
    <script src="./message_cn.js"></script>
    <script>
      $('#myform').validate({
        rules: {
          uname: {
            required: true,
          },
          // 组合规则。
          email: {
            required: true,
            email: true,
          },
        },

        /**
         * @brief: 定义自定义消息的键/值对
         * @value {string | object}
         * {string} '' 默认为此项必填时的提示内容；
         * {object} 值为对象时，可设置多个规则；
         * !注意：这里优先级高于配置的内容
         */
        messages: {
          //name没有填时展示的信息
          uname: '输--名称',
          email: {
            //email没有填时展示的信息
            required: 'We need your email address to contact you',
            //email违规时展示的信息
            email: 'Your email address must be in the format of name@domain.com',
          },
        },
      })
    </script>
  </body>
</html>
